﻿using System.Collections.Generic;
using System.Linq;
using AutoMapper;
using SocialFront.Core.Domain;
using SocialFront.Services.Application.ViewModels;

namespace SocialFront.Core.Mapping.FooMappers
{
    public static class FooMappers
    {
        public static FooView ConvertToFooView(this Foo foo)
        {
            return Mapper.Map<Foo, FooView>(foo);
        }

        public static IEnumerable<FooView> ConvertToFooView(this IEnumerable<Foo> foos)
        {
            return foos.Select(foo => foo.ConvertToFooView()).ToList();
        }

        public static Foo ConvertToFoo(this FooView fooView)
        {
            return Mapper.Map<FooView, Foo>(fooView);
        }

        public static IEnumerable<Foo> ConvertToFoo(this IEnumerable<FooView> fooViews)
        {
            return fooViews.Select(fooView => fooView.ConvertToFoo()).ToList();
        }
    }
}
